package myproject.main;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.apache.log4j.Logger;

import myproject.api.ThreeD;

/**
*
* @ClassName: ThreeData2020Main
* @Description:福彩3D相关数据入库
* @author: lk
* @date: 2020年4月7日
*
* @Copyright: 2020
*
*/
public class ThreeDataMain {
	private static final Logger log = Logger.getLogger(ThreeDataMain.class);
	private static final String filePath="E:/lottery/welfare/newwelfare.txt";
	private static final String outPath ="E:/lottery/welfare/sort/";
	
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		long startTime=System.currentTimeMillis();
		
		//读取文件内容,新增数据入库
		//日期、期号、结果、百位、十位、个位
		log.info("读取文件内容");
		
		List<ThreeD> threedlist=ArrayDatabase.readTxtFile(filePath);
		log.info("入库日期、期号、结果、百位、十位、个位、和值");
		ArrayDatabase.insertThreeData(threedlist);
//		log.info("更新已有数据的跨度，形态，组选，除三余数，组三中的重复数字");
//		ArrayDatabase.updateThreeData();
		log.info("更新同和值的遗漏期数");
		ArrayDatabase.updateSumDays("welfare");
		
		
		
		//按和值分组生成文件
		Date date = new Date();
		SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		log.info(dateFormat.format(date));
		ArrayDatabase.assortNewTxt(outPath,"welfare");
		ArrayDatabase.assortNewXls(outPath,"welfare");
//		ArrayDatabase.assortTxt(outPath,"welfare");
//		ArrayDatabase.assortXls(outPath,"welfare");
		
		long endTime=System.currentTimeMillis();
		System.out.println("福彩3D执行时间："+(endTime-startTime)+"ms");
		System.out.println("福彩3D执行时间："+(endTime-startTime)+"ms");
		System.out.println("福彩3D执行时间："+(endTime-startTime)+"ms");
		
		}
	
}
